<?php

use App\Models\AdminInfo;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $user = Sentinel::registerAndActivate([
                'username' => 'superadmin',
                'password' => 'superadmin',
                'is_admin' => 1,
            ]);
        $role = Sentinel::findRoleBySlug('admin');
        $role->users()->attach($user);
        AdminInfo::create(['user_id' => $user->id]);

         if(env('APP_ENV') == 'local'){
            Sentinel::registerAndActivate([
                'username' => 'simulate-openid1',
                'password' => 'simulate-user1',
            ]);

            Sentinel::registerAndActivate([
                'username' => 'simulate-openid2',
                'password' => 'simulate-user2',
            ]);

            Sentinel::registerAndActivate([
                'username' => 'simulate-openid3',
                'password' => 'simulate-user3',
            ]);

            Sentinel::registerAndActivate([
                'username' => 'simulate-openid5',
                'password' => 'simulate-user5',
            ]);

            Sentinel::registerAndActivate([
                'username' => 'simulate-openid6',
                'password' => 'simulate-user6',
            ]);

            Sentinel::registerAndActivate([
                'username' => 'simulate-openid4',
                'password' => 'simulate-user4',
            ]);
        }
        
    }
}
